﻿<cfsilent>
	<cfscript>
		
		sessionAdvice = getProperty("serviceFactory").getBean("sessionAdvice");
		
		event.setArg("pageTitle", "教学质量评价 - 教学班评价情况");
		
		depId = sessionAdvice.getUserProp("teacherDepartment");
		
		currentTab = event.getArg("TabID", "labTaskList");
		
		keyword = event.getArg("Keywords");
		
		/* 学院教学任务列表 */
		sql = "SELECT 
					a.task_type, a.task_id, 
					a.course_code, a.course_name, a.cidx, 
					a.task_week, 
					a.tch_id, a.tch_id_sec, a.tch_id_ace, 
					a.tch_name, a.tch_name_sec, a.tch_name_ace, 
					b.es_id, 
					c.evs_need, c.evs_progress, c.evs_done, 
					c.comment_send, c.comment_reply 
					FROM mv_running_task a 
					INNER JOIN t_course_evaluate b ON b.cid = a.cid 
					INNER JOIN t_evaluate_task c ON c.task_id = a.task_id 
					WHERE 
						a.institute_id = :depId 
					ORDER BY 
						a.course_name, a.tch_name "; 

		queryObj = new Query( datasource=application.dnsSlave );
		queryObj.addParam( name="depId", value=depId, cfsqltype="cf_sql_varchar" );

		rs_task = queryObj.execute( sql=sql ).getResult();

		/* 教学任务搜索 */
		rs_search = queryNew("es_id, institute_short, task_type, task_id, course_code, course_name, course_credit, task_week, tch_name, tch_name_sec, tch_name_ace");
		
		if ( len(keyword) ) { 
			
			sql = "SELECT 
						task_type, task_id, 
						course_code, course_name, cidx, 
						task_week, 
						tch_name, tch_name_sec, tch_name_ace, 
						es_id, 
						evs_need, evs_progress, evs_done, 
						comment_send, comment_reply 
						FROM query 
						WHERE 
							( 
							tch_id LIKE :teacherId 
							OR 
							tch_id_sec LIKE :teacherId 
							OR 
							tch_id_ace LIKE :teacherId 
							OR 
							tch_name LIKE :teacherName 
							OR 
							tch_name_sec LIKE :teacherName 
							OR 
							tch_name_ace LIKE :teacherName 
							OR 
							course_code LIKE :courseCode 
							OR 
							course_name LIKE :courseName 
							) 
						";
			
			queryObj = new Query( dbtype="query" );
			queryObj.setAttributes( query=rs_task );
			queryObj.addParam( name="teacherId", value=keyword & "%", cfsqltype="cf_sql_varchar" );
			queryObj.addParam( name="teacherName", value=keyword & "%", cfsqltype="cf_sql_varchar" );
			queryObj.addParam( name="courseCode", value=keyword & "%", cfsqltype="cf_sql_varchar" );
			queryObj.addParam( name="courseName", value=keyword & "%", cfsqltype="cf_sql_varchar" );

			rs_search = queryObj.execute( sql=sql ).getResult();
			
			
		}
		
		passArgs = structNew();
		
	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
				<a class="uiButton" href="<cfoutput>#buildURL('DEFAULT_EVENT')#</cfoutput>"><i class="mrs img btnPublish"></i><span class="uiButtonText">教学质量评价</span></a>
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 card"></i>教学班质量评教详细情况
				</h2>
			</div>
		</div>
	</div>
</div>

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="summary">
				<div class="UItab">
					<div class="tabLables">
						<span <cfif currentTab eq "labSearch">class="active"</cfif> id="labSearch" tabTarget="Search">查询评教数据</span>
						<span <cfif currentTab eq "labTaskList">class="active"</cfif> id="labTaskList" tabTarget="TaskList">教学班列表</span>
					</div>
				</div>
				<script language="javascript" type="text/javascript">
					//<![CDATA[
					<!--
					$(document).ready(function() {
						
						/* init Tab */
						$("div.tabContent").hide();
						$("div#" + $("div.tabLables span.active").attr("tabTarget")).show();
						
						$("div.tabLables > span").click(function(){
							var $targetID = $(this).attr("tabTarget");
							
							$("div.tabLables span").removeClass("active");
							$(this).addClass("active");
							
							$("div.tabContent").not('[id="' + $targetID + '"]').hide();
							$("div.tabContent#" + $targetID).show();
						});
						
					});
					// -->
					//]]>				
				</script>
				
				<div id="Search" class="tabContent">
					
					<form id="formSearch" onSubmit="javascript:return processVerfiyForm('formSearch');" class="formWrapper Transparent" method="post" action="<cfoutput>#buildURL('evaluateTask')#</cfoutput>" />
						
						<input name="TabID" type="hidden" value="labSearch" />
						
						<div class="label">
							<b>教师姓名或职工号</b>
							<input name="Keywords" id="Keywords" type="text" class="typeText" verification="required" maxlength="128" value="<cfoutput>#event.getArg('Keywords')#</cfoutput>" />
							<p class="notice">可以根据教师、职工号或课程名称、课程代码进行教学任务查找</p>
						</div>
						<hr/>
						<div class="lable">
							<input class="button" type="submit" value="搜索教学任务" />
						</div>
					</form>
					
					<cfif rs_search.recordCount >
					
						<table class="UIEditable">
								<thead>
									<tr>
										<td width="20"></td>
										<td width="90">课程号</td>
										<td width="60">课序号</td>
										<td>教学任务</td>
										<td width="50">周次</td>
										<td width="40">需评教</td>
										<td width="40">已完成</td>
										<td width="40">进行中</td>
										<td width="30">评论</td>
										<td width="30">回复</td>
										<td width="20"></td>
									</tr>
								</thead>
								<tbody>
									<cfset row = 0 />
									<cfloop query="rs_search">
											
										<cfset row++ />
										
										<!--- 教师列表 --->
										<cfset teacherList = rs_search.tch_name />
										<cfif not listFind( teacherList, rs_search.tch_name_sec, "/" ) >
											<cfset teacherList = listAppend( teacherList, rs_search.tch_name_sec, "/" ) />
										</cfif>
										<cfif not listFind( teacherList, rs_search.tch_name_ace, "/" ) >
											<cfset teacherList = listAppend( teacherList, rs_search.tch_name_ace, "/" ) />
										</cfif>
										
										<cfset structInsert(passArgs, "ES", rs_search.es_id, true) />
										<cfset structInsert(passArgs, "TSK", rs_search.task_id, true) />
										<cfset structInsert(passArgs, "TT", rs_search.task_type, true) />

										<tr class="editRows">
											<td class="index"><cfoutput>#row#</cfoutput></td>
											<td><span class="numeric"><cfoutput>#rs_search.course_code#</cfoutput></span></td>
											<td><span class="numeric"><cfoutput>#rs_search.cidx#</cfoutput></span></td>
											<td><cfoutput>#rs_search.course_name#</cfoutput><span class="numeric"> - </span><cfoutput>#teacherList#</cfoutput></td>
											<td><span class="numeric"><cfoutput>#rs_search.task_week#</cfoutput></span></td>
											<td align="center"><span class="numeric"><cfoutput>#rs_search.evs_need#</cfoutput></span></td>
											<td align="center"><span class="numeric"><cfoutput>#rs_search.evs_done#</cfoutput></span></td>
											<td align="center"><span class="numeric"><cfoutput>#rs_search.evs_progress#</cfoutput></span></td>
											<td align="center"><span class="numeric"><cfoutput>#rs_search.comment_send#</cfoutput></span></td>
											<td align="center"><span class="numeric"><cfoutput>#rs_search.comment_reply#</cfoutput></span></td>
											<td><a class="stat details" title="查看该教学班评教结果" href="<cfoutput>#buildURL('evaluateTaskResult', passArgs)#</cfoutput>"></a></td>
										</tr>
										
									</cfloop>
								</tbody>
							</table>
						
						</cfif>
					
				</div>
				
				<div id="TaskList" class="tabContent">
					
					<div class="noticeBlock">
						<h3>学院（部、中心）网上评教 教学班列表</h3>
						<p><span class="img icon16x16 message"></span>下列是您所在部门所开设课程, 参与网上教学质量评价的教学班列表</p>
						<hr/>
					</div>
					
					<cfif rs_task.recordCount >
					
						<table class="UIEditable">
								<thead>
									<tr>
										<td width="20"></td>
										<td width="90">课程号</td>
										<td width="60">课序号</td>
										<td>教学任务</td>
										<td width="50">周次</td>
										<td width="40">需评教</td>
										<td width="40">已完成</td>
										<td width="40">进行中</td>
										<td width="30">评论</td>
										<td width="30">回复</td>
										<td width="20"></td>
									</tr>
								</thead>
								<tbody>
									<cfset row = 0 />
									<cfloop query="rs_task">
											
										<cfset row++ />
										
										<!--- 教师列表 --->
										<cfset teacherList = rs_task.tch_name />
										<cfif not listFind( teacherList, rs_task.tch_name_sec, "/" ) >
											<cfset teacherList = listAppend( teacherList, rs_task.tch_name_sec, "/" ) />
										</cfif>
										<cfif not listFind( teacherList, rs_task.tch_name_ace, "/" ) >
											<cfset teacherList = listAppend( teacherList, rs_task.tch_name_ace, "/" ) />
										</cfif>
										
										<cfset structInsert(passArgs, "ES", rs_task.es_id, true) />
										<cfset structInsert(passArgs, "TSK", rs_task.task_id, true) />
										<cfset structInsert(passArgs, "TT", rs_task.task_type, true) />

										<tr class="editRows">
											<td class="index"><cfoutput>#row#</cfoutput></td>
											<td><span class="numeric"><cfoutput>#rs_task.course_code#</cfoutput></span></td>
											<td><span class="numeric"><cfoutput>#rs_task.cidx#</cfoutput></span></td>
											<td><cfoutput>#rs_task.course_name#</cfoutput><span class="numeric"> - </span><cfoutput>#teacherList#</cfoutput></td>
											<td><span class="numeric"><cfoutput>#rs_task.task_week#</cfoutput></span></td>
											<td align="center"><span class="numeric"><cfoutput>#rs_task.evs_need#</cfoutput></span></td>
											<td align="center"><span class="numeric"><cfoutput>#rs_task.evs_done#</cfoutput></span></td>
											<td align="center"><span class="numeric"><cfoutput>#rs_task.evs_progress#</cfoutput></span></td>
											<td align="center"><span class="numeric"><cfoutput>#rs_task.comment_send#</cfoutput></span></td>
											<td align="center"><span class="numeric"><cfoutput>#rs_task.comment_reply#</cfoutput></span></td>
											<td><a class="stat details" title="查看该教学班评教结果" href="<cfoutput>#buildURL('evaluateTaskResult', passArgs)#</cfoutput>"></a></td>
										</tr>
										
									</cfloop>
								</tbody>
							</table>
					
						<cfelse>
						
							<div class="systemNotice">
								<p>目前没有参与评教的教学班数据</p>
							</div>
						
					</cfif>
					
					
				</div>
				
			</div>
		</li>
	</ul>
</div>